//
//  POptionCollectionViewCell.m
//  图片故事
//
//  Created by 大帅逼 on 16/3/1.
//  Copyright © 2016年 helloApp. All rights reserved.
//

#import "POptionCollectionViewCell.h"
#import "Header.h"

@interface POptionCollectionViewCell ()



@end

@implementation POptionCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {

    if (self = [super initWithFrame:frame]) {
        
        // 初始化子控件
        _optionImageView = [[UIImageView alloc] init];
        
        [self.contentView addSubview:_optionImageView];
        
        _optionTitleLabel = [[UILabel alloc] init];
        
        [_optionTitleLabel setTextColor:[UIColor whiteColor]];
        
        [_optionTitleLabel setTextAlignment:NSTextAlignmentCenter];
        
        [_optionTitleLabel setFont:[UIFont systemFontOfSize:12]];
        
        [self.contentView addSubview:_optionTitleLabel];
    }
    
    return self;
}

- (void)layoutSubviews {

    [super layoutSubviews];
    
    // 设置子控件位置
    [_optionImageView setBounds:CGRectMake(0, 0, My_Height(30), My_Height(30))];
    
    [_optionImageView setCenter:CGPointMake(SCREEN_W / 8, My_Height(20))];
    
    [_optionTitleLabel setBounds:CGRectMake(0, 0, My_Height(40), My_Width(20))];
    
    [_optionTitleLabel setCenter:CGPointMake(SCREEN_W / 8, My_Height(45))];
}

- (void)setPrecessOption:(PrecessOptionModel *)precessOption {

    _precessOption = precessOption;
    
    // 设置子控件数据
    [_optionImageView setImage:[UIImage imageNamed:_precessOption.optionImageName]];
    
    [_optionTitleLabel setText:_precessOption.optionTilte];
}

@end
